/******************************************************************************
 * * sms_ussd.c - implementation of sms send ussd functions
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#include "sms_include.h"

/**
 * sub-module entry
 * param (in) lv_obj_t *pBtn,lv_event_t event
 * return  VOID
 */
VOID Sms_Ussd(lv_obj_t *pBtn,lv_event_t event)
{
    // sms send ussd function
    // create Messages_Command_Editor chart
    Nav_Func_List_t             FuncList;
    UI_Normal_NoTitle_Ta_Desc_t *pUssd = NULL;

    if(LV_EVENT_CLICKED != event)
    {
        return;
    }

    pUssd = (UI_Normal_NoTitle_Ta_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Ta_Desc_t));
    Hal_Mem_Set(pUssd, 0, sizeof(UI_Normal_NoTitle_Ta_Desc_t));

    g_MsgGlobalCtrl.CurOpenBox = SERVICE_COM_EDITOR;
    g_MsgGlobalCtrl.pChart     = pUssd;

    pUssd->ContLabelTl.TxtId       = LV_LANG_TXT_ID_NONE;
    pUssd->ContLabelTl.SymbolId    = LV_SYMBOL_EDIT; // temp
    pUssd->ContLabelTl.SymbolAlign = LV_LABEL_ALIGN_LEFT;

    pUssd->ContLabelTr.TxtId   = LV_LANG_TXT_ID_NONE;
    pUssd->ContTa.TaTxt        = NULL;
    pUssd->ContTa.TaCursorHide = FALSE;

    pUssd->ButtonBar.ButtonL.TxtId      = PHONE_TEXT_ID_BACK;
    pUssd->ButtonBar.ButtonL.ReleaseFun = NULL;
    pUssd->ButtonBar.ButtonL.Valid      = true;

    pUssd->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_SEND;
    pUssd->ButtonBar.ButtonM.Valid = true;

    pUssd->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_CLEAR;
    pUssd->ButtonBar.ButtonR.Valid = true;

    pUssd->KeyFunc = Sms_Ussd_Handle;

    FuncList.OnShow         = (Void_P_Func_t)UI_Normal_NoTitle_Ta_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Ussd_On_Create;
    FuncList.OnDestroy      = Sms_Common_All_Global_Destory; // temp
    FuncList.OnSaveState    = Sms_Ussd_On_Save;              // temp
    FuncList.OnRestoreState = Sms_Ussd_On_Create;            // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_COMMAND_EDITOR, &FuncList, (void *)pUssd);
} /* Sms_Ussd */

/**
 * Common Process UI save event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Sms_Ussd_On_Save(VOID *pDesc)
{
    INT8                        str[]   = "\0";
    INT8                        *pTemp  = NULL;
    UI_Normal_NoTitle_Ta_Desc_t *pUssd  = pDesc;

    g_MsgGlobalCtrl.pChart = NULL;
    Hal_Mem_Free(g_MsgGlobalCtrl.pSmsText);
    g_MsgGlobalCtrl.pSmsText = NULL;
    pTemp                    = (INT8 *)lv_textarea_get_text(pUssd->ContTa.TextArea);
    if (false == strcmp(str, pTemp))
    {
        return;
    }
    g_MsgGlobalCtrl.pSmsText = Hal_Mem_Alloc(NV_SMS_MAX_INPUT_NUM);
    Hal_Mem_Set(g_MsgGlobalCtrl.pSmsText, 0, NV_SMS_MAX_INPUT_NUM);

    strcpy(g_MsgGlobalCtrl.pSmsText, pTemp);
}

/**
 * Process UI input char number event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Sms_Ussd_Input_char_Process(UINT8 Len)
{
    UI_Normal_NoTitle_Ta_Desc_t *pUssd = g_MsgGlobalCtrl.pChart;

    lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, FALSE);
}

/**
 * Common Process UI Create event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Sms_Ussd_On_Create(VOID *pDesc)
{
    UI_Normal_NoTitle_Ta_Desc_t *pUssd = NULL;

    g_MsgGlobalCtrl.pChart = pDesc;
    pUssd                  = g_MsgGlobalCtrl.pChart;

    lv_textarea_set_max_length(pUssd->ContTa.TextArea, MSG_INPUT_WORD_MAX_LEN);

    if (NULL != g_MsgGlobalCtrl.pSmsText)
    {
        lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, FALSE);
        lv_textarea_set_text(pUssd->ContTa.TextArea, g_MsgGlobalCtrl.pSmsText);
    }
    else
    {
        lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, TRUE);
    }
    Ime_Set_GetCharLen_Func(Sms_Ussd_Input_char_Process);
    Ime_Set_Mode(LV_IME_MODE_ENGLISH);
}

/**
 * entry of message APP
 * param (in) lv_obj_t * obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val
 * return  UINT8
 */
UINT8 Sms_Ussd_Handle(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                       Result = 0;
    UINT32                      i      = 0;
    INT8                        *pTemp;
    UI_Normal_NoTitle_Ta_Desc_t *pUssd = g_MsgGlobalCtrl.pChart;    // temp

    // handle the return key
    if (KEY_RELEASED == key_sta)
    {
        switch (key_val)
        {
        case KEY_0:
        case KEY_1:
        case KEY_2:
        case KEY_3:
        case KEY_4:
        case KEY_5:
        case KEY_6:
        case KEY_7:
        case KEY_8:
        case KEY_9:
        case KEY_ASTERISK:
            pTemp = (INT8 *)lv_textarea_get_text(obj);            // temp
            i     = strlen(pTemp);
            if(i == MSG_INPUT_WORD_MAX_LEN)
            {
                Result = 1;
            }
            lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, FALSE);
            break;

        case KEY_SOFTRIGHT:
            pTemp = (INT8 *)lv_textarea_get_text(obj);
            if (strlen(pTemp) > 0)
            {
                lv_textarea_del_char(obj);
            }
            pTemp = (INT8 *)lv_textarea_get_text(obj);
            if (0 == strlen(pTemp))
            {
                lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, TRUE);
            }
            else
            {
                lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, FALSE);
            }
            Result = 1;
            break;

        case KEY_SOFTLEFT:
            Nav_Back(ACT_ID_ANY);
            Result = 1;
            break;

        case KEY_OK:
            pTemp = (INT8 *)lv_textarea_get_text(obj); // temp
            if (strlen(pTemp))
            {                                    // Send
                Sms_Ussd_Send();
            }
            Result = 1;
            break;

        case KEY_END:
            Nav_Home(ACT_ID_ANY);
            Result = 1;
            break;

        default:
            break;
        } /* switch */
    }
    else if (KEY_LONGPRESS == key_sta)
    {    // clear all
        if (KEY_SOFTRIGHT == key_val)
        {
            lv_textarea_set_text(obj, "");
            lv_obj_set_hidden(pUssd->ButtonBar.ButtonM.Button, TRUE);
        }
    }
    return(Result);   // temp
} /* Sms_Ussd_Handle */

/**
 * sub-module entry
 * param (in) lv_obj_t *pBtn
 * return  lv_res_t
 */
VOID Sms_Ussd_Send(VOID)
{
    // create Messages_Sim_Selection chart
    Nav_Func_List_t            FuncList;
    UI_Normal_List_Only_Desc_t *pUssdSend  = NULL;
    UI_Button_Desc_t           *ButtonList = NULL;
    SMS_SIM_STATUS             SimStatus   = SMS_NO_SIM_PRESENT;

    pUssdSend = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(pUssdSend, 0, sizeof(UI_Normal_List_Only_Desc_t));

    g_MsgGlobalCtrl.pChart = pUssdSend;

    pUssdSend->TitleBar.TxtId      = PHONE_TEXT_ID_SIM_SEL;
    pUssdSend->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pUssdSend->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_MID;

    SimStatus = Sms_Get_Sim_Status();
    if (SMS_SIM1_PRESENT == (SimStatus & SMS_SIM1_PRESENT))
    {
        pUssdSend->List.ListButtonCnt++;
    }
    if (SMS_SIM2_PRESENT == (SimStatus & SMS_SIM2_PRESENT))
    {
        pUssdSend->List.ListButtonCnt++;
    }
    if (pUssdSend->List.ListButtonCnt)
    {
        ButtonList = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * pUssdSend->List.ListButtonCnt);
        Hal_Mem_Set(ButtonList, 0, sizeof(UI_Button_Desc_t) * pUssdSend->List.ListButtonCnt);
        pUssdSend->List.Index      = 0;
        pUssdSend->List.ButtonList = ButtonList;

        if (SMS_BOTH_SIM_PRESENT == SimStatus)
        {
            ButtonList[0].ButtonIndex = 0;
            ButtonList[0].TxtId       = PHONE_TEXT_ID_SIM1;
            ButtonList[0].SymbolId1   = SYMBOL_SIM1;
            ButtonList[0].Valid       = true;
            ButtonList[0].ReleaseFun  = Sms_Ussd_Send_Sim_Select;

            ButtonList[1].ButtonIndex = 1;
            ButtonList[1].TxtId       = PHONE_TEXT_ID_SIM2;
            ButtonList[1].SymbolId1   = SYMBOL_SIM2;
            ButtonList[1].Valid       = true;
            ButtonList[1].ReleaseFun  = Sms_Ussd_Send_Sim_Select;
        }
        else if (SMS_SIM1_PRESENT == SimStatus)
        {
            ButtonList[0].ButtonIndex = 0;
            ButtonList[0].TxtId       = PHONE_TEXT_ID_SIM1;
            ButtonList[0].SymbolId1   = SYMBOL_SIM1;
            ButtonList[0].Valid       = true;
            ButtonList[0].ReleaseFun  = Sms_Ussd_Send_Sim_Select;
        }
        else if (SMS_SIM2_PRESENT == SimStatus)
        {
            ButtonList[0].ButtonIndex = 0;
            ButtonList[0].TxtId       = PHONE_TEXT_ID_SIM2;
            ButtonList[0].SymbolId1   = SYMBOL_SIM2;
            ButtonList[0].Valid       = true;
            ButtonList[0].ReleaseFun  = Sms_Ussd_Send_Sim_Select;
        }
    }

    pUssdSend->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pUssdSend->BtnBar.ButtonR.Valid = true;

    if(SimStatus != SMS_NO_SIM_PRESENT)
    {
        pUssdSend->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_SELECT;
        pUssdSend->BtnBar.ButtonM.Valid = true;
    }
    else
    {
        pUssdSend->BtnBar.ButtonM.Valid = false;
    }

    pUssdSend->KeyFunc = Sms_Create_Opt_Handle;    // common

    FuncList.OnShow         = (Void_P_Func_t)UI_Normal_List_Only_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Create_Send_To_Many_Create;
    FuncList.OnDestroy      = Sms_List_Only_Common_Destory;   // temp
    FuncList.OnSaveState    = Sms_Common_Save;                // temp
    FuncList.OnRestoreState = Sms_Create_Send_To_Many_Create; // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_SIM_SELECTION, &FuncList, (void *)pUssdSend);
} /* Sms_Ussd_Send */

/**
 * sub-module entry
 * param (in) lv_obj_t *pBtn,lv_event_t event
 * return  VOID
 */
VOID Sms_Ussd_Send_Sim_Select(lv_obj_t *pBtn,lv_event_t event)
{
    // Sim selection function
    // send the ussd code
    // create Messages_Command_Status chart
    UINT32                    i      = 0;
    Nav_Func_List_t           FuncList;
    UI_Normal_NoTitle_Desc_t  *pCmdSts      = NULL;
    MMI_Modem_Send_Ussd_Req_t *pSendUssdReq = NULL;

    if(LV_EVENT_CLICKED != event)
    {
        return;
    }

    pCmdSts = (UI_Normal_NoTitle_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Desc_t));
    Hal_Mem_Set(pCmdSts, 0, sizeof(UI_Normal_NoTitle_Desc_t));

    g_MsgGlobalCtrl.CurrSimId = (MMI_MODEM_SIM_ID)pBtn->user_data.user_num;

    pCmdSts->ContenCont.ContLabel.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pCmdSts->ContenCont.ContLabel.TxtId      = PHONE_TEXT_ID_REQUESTING;
    pCmdSts->ContenCont.ContLabel.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pCmdSts->ContenCont.ContLabelAlign       = LV_ALIGN_IN_TOP_LEFT;

    pCmdSts->ContenCont.ContImg.Img = IMG_PROGRESS_BAR;

    pCmdSts->ContenCont.ContImg.ImgAlign = LV_ALIGN_IN_BOTTOM_LEFT;
    pCmdSts->ContenCont.ContImgAlign     = LV_ALIGN_IN_BOTTOM_LEFT;

    pCmdSts->ButtonBar.ButtonR.ButtonIndex = 0;
    pCmdSts->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_QUIT;
    pCmdSts->ButtonBar.ButtonR.Valid       = true;

    pCmdSts->KeyFunc = Sms_Ussd_Send_Sim_Select_Handle;

    FuncList.OnShow         = (Void_P_Func_t)UI_Normal_NoTitle_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Common_Create;
    FuncList.OnDestroy      = Sms_Common_Destory; // temp,delete all global
    FuncList.OnSaveState    = Sms_Common_Save;    // temp
    FuncList.OnRestoreState = Sms_Common_Restore; // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_COMMAND_STATUS, &FuncList, (void *)pCmdSts);

    i = strlen(g_MsgGlobalCtrl.pSmsText);
    if (i)
    {
        pSendUssdReq = (MMI_Modem_Send_Ussd_Req_t *)Hal_Mem_Alloc(sizeof(MMI_Modem_Send_Ussd_Req_t));
        Hal_Mem_Set(pSendUssdReq, 0, sizeof(MMI_Modem_Send_Ussd_Req_t));
        pSendUssdReq->pSendUssdReq = Hal_Mem_Alloc(i + 1);
        Hal_Mem_Set(pSendUssdReq->pSendUssdReq, 0, i + 1);
        strcat(pSendUssdReq->pSendUssdReq, g_MsgGlobalCtrl.pSmsText);
        pSendUssdReq->SimId = g_MsgGlobalCtrl.CurrSimId;
        MMI_Modem_Send_Ussd_Req(pSendUssdReq);
    }
    else
    {
        Sms_Ussd_Send_Result_Fail();
    }
} /* Sms_Ussd_Send_Sim_Select */

/**
 * entry of message APP
 * param (in) lv_obj_t * obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val
 * return  UINT8
 */
UINT8 Sms_Ussd_Send_Sim_Select_Handle(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8 Result = 0;

    // handle the return key
    if (KEY_RELEASED == key_sta)
    {
        if (KEY_SOFTRIGHT == key_val)
        {
            Sms_Ussd_Cmd_Quit(NULL);
            Result = 1;
        }
    }

    return(Result);   // temp
}

/**
 * sub-module entry
 * param (in) lv_obj_t *pBtn
 * return  lv_res_t
 */
lv_res_t Sms_Ussd_Cmd_Quit(lv_obj_t *pBtn)
{
    // quit Ussd Send Status
    // inform modem adapter abort:MMI_Modem_Ussd_Cancel_Req
    MMI_Modem_Ussd_Cancel_Req(g_MsgGlobalCtrl.CurrSimId);
    Sms_Ussd_Send_Result_Abort();
    return(LV_RES_OK);
}

/**
 * sub-module entry
 * param (in) MSG_USSD_RESULT_TYPE Result,INT8 *pUssdCnf
 * return  VOID
 */
VOID Sms_Ussd_Send_Result(MSG_USSD_RESULT_TYPE Result, INT8 *pUssdCnf)
{
    // Ussd Send Result
    // create Messages_Command_Result chart
    Nav_Func_List_t          FuncList;
    UI_Normal_NoTitle_Desc_t *pSendResult = NULL;

    pSendResult = (UI_Normal_NoTitle_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Desc_t));
    Hal_Mem_Set(pSendResult, 0, sizeof(UI_Normal_NoTitle_Desc_t));

    g_MsgGlobalCtrl.pChart = pSendResult;

    pSendResult->ContenCont.ContLabel.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (MSG_USSD_UNKNOWN_CMD == Result)
    {
        pSendResult->ContenCont.ContLabel.TxtId = PHONE_TEXT_ID_UNKOWN_APPLICATION;
    }
    else
    {
        pSendResult->ContenCont.ContLabel.TxtId = LV_LANG_TXT_ID_NONE;
// pSendResult->ContenCont.ContLabel.TxtFont = (lv_font_t *)pUssdCnf;
    }

    pSendResult->ContenCont.ContLabel.TxtAlign = LV_LABEL_ALIGN_LEFT;
    pSendResult->ContenCont.ContLabelAlign     = LV_ALIGN_IN_TOP_LEFT;

    pSendResult->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pSendResult->ButtonBar.ButtonR.Valid = true;

    pSendResult->KeyFunc = Sms_Cmd_Result_Handle;

    FuncList.OnShow         = (Void_P_Func_t)UI_Normal_NoTitle_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Common_Create;
    FuncList.OnDestroy      = Sms_Common_Destory; // temp
    FuncList.OnSaveState    = Sms_Common_Save;    // temp
    FuncList.OnRestoreState = Sms_Common_Restore; // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_COMMAND_RESULT, &FuncList, (void *)pSendResult);
    if (MSG_USSD_CMD_SUCCESS == Result)
    {
        lv_label_set_text(pSendResult->ContenCont.ContLabel.Label, pUssdCnf);
    }
} /* Sms_Ussd_Send_Result */

/**
 * entry of message APP
 * param (in) lv_obj_t * obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val
 * return  UINT8
 */
UINT8 Sms_Cmd_Result_Handle(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8 Result = 0;

    // handle the return key
    if (KEY_RELEASED == key_sta)
    {
        if ((KEY_SOFTRIGHT == key_val) || (KEY_END == key_val))
        {
            Nav_Home(ACT_ID_ANY);
            Result = 1;
        }
    }

    return(Result);    // temp
}

/**
 * sub-module entry
 * param (in) MSG_USSD_RESULT_TYPE Result,INT8 *pUssdCnf
 * return  VOID
 */
VOID Sms_Ussd_Send_Result_Fail(VOID)
{
    // Ussd Send Result
    // create Messages_Command_Result_Fail chart
    Nav_Func_List_t  FuncList;
    UI_Status_Desc_t *pSendResult = NULL;
    CB_FUNC          callback     = Sms_Ussd_Send_Result_Timeout;

    pSendResult = (UI_Status_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Status_Desc_t));
    Hal_Mem_Set(pSendResult, 0, sizeof(UI_Status_Desc_t));

    pSendResult->ContLabel.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pSendResult->ContLabel.TxtId      = PHONE_TEXT_ID_NOT_CONFIRMED;
    pSendResult->ContLabel.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pSendResult->ContLabelAlign       = LV_ALIGN_IN_TOP_LEFT;

    pSendResult->ContImg.Img = LV_SYMBOL_WARNING;

    pSendResult->ContImg.ImgAlign = LV_ALIGN_IN_TOP_RIGHT;
    pSendResult->ContImgAlign     = LV_ALIGN_IN_TOP_RIGHT;

    FuncList.OnShow         = (Void_P_Func_t)UI_Status_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Common_Create;
    FuncList.OnDestroy      = Sms_Common_Destory; // temp,delete all global
    FuncList.OnSaveState    = Sms_Common_Save;    // temp
    FuncList.OnRestoreState = Sms_Common_Restore; // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_COMMAND_RESULT_FAIL, &FuncList, (void *)pSendResult);

    // 2s timer start
    Sms_Timer_Create_And_Start(callback, ACT_ID_MESSAGES_COMMAND_RESULT_FAIL);
}

/**
 * sub-module entry
 * param (in) MSG_USSD_RESULT_TYPE Result,INT8 *pUssdCnf
 * return  VOID
 */
VOID Sms_Ussd_Send_Result_Abort(VOID)
{
    Nav_Func_List_t  FuncList;
    UI_Status_Desc_t *pSendResult = NULL;
    CB_FUNC          callback     = Sms_Ussd_Send_Result_Timeout;

    pSendResult = (UI_Status_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Status_Desc_t));
    Hal_Mem_Set(pSendResult, 0, sizeof(UI_Status_Desc_t));

    pSendResult->ContLabel.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pSendResult->ContLabel.TxtId      = PHONE_TEXT_ID_NOT_COMPLETED;
    pSendResult->ContLabel.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pSendResult->ContLabelAlign       = LV_ALIGN_IN_TOP_LEFT;

    pSendResult->ContImg.Img = LV_SYMBOL_WARNING;

    pSendResult->ContImg.ImgAlign = LV_ALIGN_IN_TOP_RIGHT;
    pSendResult->ContImgAlign     = LV_ALIGN_IN_TOP_RIGHT;

    FuncList.OnShow         = (Void_P_Func_t)UI_Status_Create;
    FuncList.OnHide         = NULL;
    FuncList.OnCreate       = Sms_Common_Create;
    FuncList.OnDestroy      = Sms_Common_Destory; // temp,delete all global
    FuncList.OnSaveState    = Sms_Common_Save;    // temp
    FuncList.OnRestoreState = Sms_Common_Restore; // temp

    Nav_Forward(ACT_ID_ANY, ACT_ID_MESSAGES_COMMAND_RESULT_ABORT, &FuncList, (void *)pSendResult);

    // 2s timer start
    Sms_Timer_Create_And_Start(callback, ACT_ID_MESSAGES_COMMAND_RESULT_ABORT);
}

/**
 * sub-module entry
 * param (in) VOID
 * return  VOID
 */
VOID Sms_Ussd_Send_Result_Timeout(VOID* id)
{
    UINT32* Id = (UINT32 *)id;
    Nav_Home(*Id);
}
